﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Windows.Controls;
using System.Windows;

namespace Bixas.Tangibilis.Controls
{
    public class TouchListBox : ListBox
    {
        static TouchListBox()
        {
            FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchListBox), new FrameworkPropertyMetadata(typeof(TouchListBox)));
       
        }
        internal void NotifyTouchListItemSelected(TouchListBoxItem item)
        {
            item.IsSelected = true;
            this.CrackedUpdateAnchorAndActionItem(item);
        }

        private void CrackedUpdateAnchorAndActionItem(ListBoxItem listItem)
        {
            Phydeaux.Utilities.Dynamic<ListBox>.Instance.Procedure.Params.CreateDelegate("UpdateAnchorAndActionItem").Invoke(this, new object[] { listItem });

        }


        protected override DependencyObject GetContainerForItemOverride()
        {
            return new TouchListBoxItem();
        }

        protected override bool IsItemItsOwnContainerOverride(object item)
        {
            return (item is TouchListBoxItem);
        }

    }
}
